package Comprehensive_01;

import java.util.Random;

public class Demo2 {
    public static void main(String[] args) {
        Random random = new Random();
        int[] arr = new int[10];
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(151) + 50;
            sum += arr[i];
        }
        double average = (double) sum / arr.length;
        System.out.print("大于平均值的元素有:");
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > average){
                System.out.print(" " + arr[i]);
            }
        }
    }
}
